﻿<%@ Page Title="Cronograma de Frequência" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="CadastroCronogramaFrequencia.aspx.cs" Inherits="AcadPosApp.Cadastros.CadastroCronogramaFrequencia" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <style type="text/css">
        .style2
        {
            width: 304px;
        }
        .style3
        {
            width: 331px;
        }
        .style4
        {
            width: 202px;
        }
        .style6
        {
            width: 248px;
        }
        .style7
        {
            width: 232px;
        }
        .style8
        {
            width: 100%;
        }
        .style9
        {
            width: 196px;
        }
        .style10
        {
            width: 104px;
        }
        .style11
        {
            width: 486px;
        }
        .style12
        {
            width: 486px;
            font-size: small;
            color: #FF3300;
        }
    </style>
    <script language="javascript" type="text/javascript">
        function SelecionaTodosChecks(spanChk) {

            var oItem = spanChk.children;

            var theBox = (spanChk.type == "checkbox") ? spanChk : spanChk.children.item[0];

            xState = theBox.checked;

            elm = theBox.form.elements;

            for (i = 0; i < elm.length; i++)

                if (elm[i].type == "checkbox" && elm[i].id != theBox.id) {
                    if (elm[i].checked != xState)

                        elm[i].click();
                }
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:Panel ID="pnlPesquisa" runat="server" GroupingText="Consulta de Cursos">
        <table class="form-inline">
            <tr>
                <td class="style3">
                    Áreas de Conhecimento<br />
                    <asp:DropDownList ID="ddlAreaConhecimento" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlAreaConhecimento_SelectedIndexChanged"
                        Width="300px">
                    </asp:DropDownList>
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td class="style3">
                    Descrição<br />
                    <asp:TextBox ID="txtPesquisa" runat="server" MaxLength="250" Width="300px" required="required"></asp:TextBox>
                </td>
                <td>
                    &nbsp;
                    <br />
                    <asp:Button ID="btnConsultar" runat="server" OnClick="btnConsultar_Click" Text="Consultar"
                        ValidationGroup="pesquisa" Width="100px" />
                </td>
            </tr>
            <caption>
                <br />
            </caption>
        </table>
        <asp:GridView ID="gvwPesquisa" runat="server" AutoGenerateColumns="False" CssClass="mGrid"
            DataKeyNames="ID_CURSO" EmptyDataText="Dados não localizados..." GridLines="Vertical"
            Width="45%" OnRowDataBound="gvwPesquisa_RowDataBound" AllowPaging="True" OnPageIndexChanging="gvwPesquisa_PageIndexChanging"
            OnSelectedIndexChanged="gvwPesquisa_SelectedIndexChanged">
            <AlternatingRowStyle BackColor="#D3D3D3" />
            <Columns>
                <asp:CommandField ButtonType="Image" SelectImageUrl="~/Imagens/select.png" ShowSelectButton="True">
                    <ItemStyle Width="1%" />
                </asp:CommandField>
                <asp:BoundField DataField="ID_CURSO" HeaderText="Código">
                    <HeaderStyle HorizontalAlign="Center" Width="1%" />
                    <ItemStyle HorizontalAlign="Center" Width="1%" />
                </asp:BoundField>
                <asp:BoundField DataField="DESCRICAO" HeaderText="Cursos">
                    <ItemStyle HorizontalAlign="Left" Width="75%" />
                </asp:BoundField>
                <asp:TemplateField HeaderText="Status">
                    <ItemTemplate>
                        <asp:Image ID="imgStatus" runat="server" Height="25px" Width="25px" />
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Center" Width="1%" />
                    <ItemStyle HorizontalAlign="Center" Width="1%" />
                </asp:TemplateField>
                <asp:BoundField DataField="SITUACAO" HeaderText="Situação">
                    <ItemStyle Width="10%" HorizontalAlign="Center" />
                </asp:BoundField>
            </Columns>
            <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
            <PagerStyle CssClass="pagination" ForeColor="Black" HorizontalAlign="Center" />
            <SelectedRowStyle BackColor="#1E90FF" Font-Bold="True" ForeColor="White" />
            <SortedAscendingCellStyle BackColor="#F1F1F1" />
            <SortedAscendingHeaderStyle BackColor="#808080" />
            <SortedDescendingCellStyle BackColor="#CAC9C9" />
            <SortedDescendingHeaderStyle BackColor="#383838" />
        </asp:GridView>
        <br />
        <table class="style1">
            <tr>
                <td class="style2">
                    Currículo<br />
                    <asp:DropDownList ID="ddlCurriculoPesquisa" runat="server" AutoPostBack="True" Enabled="false"
                        OnSelectedIndexChanged="ddlCurriculoPesquisa_SelectedIndexChanged" Width="300px">
                    </asp:DropDownList>
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
        </table>
        <table class="style1">
            <tr>
                <td class="style4">
                    Módulo<br />
                    <asp:DropDownList ID="ddlModuloPesquisa" runat="server" AutoPostBack="True" Enabled="False"
                        OnSelectedIndexChanged="ddlModuloPesquisa_SelectedIndexChanged" Width="300px">
                    </asp:DropDownList>
                </td>
                <td class="style6">
                    <br />
                    &nbsp;&nbsp;
                    <%--<asp:Button ID="btnConsultarDisciplinas" runat="server" 
                                OnClick="btnConsultarDisciplinas_Click" Text="Consultar" Width="100px" />--%>
                </td>
            </tr>
            <%--<tr>
                <td class="style4">
                    Disciplinas
                </td>
                <td class="style6">
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td class="style4">
                    <asp:DropDownList ID="ddlDisciplinasModulo" runat="server" AutoPostBack="True" Enabled="False"
                        Width="300px">
                    </asp:DropDownList>
                </td>
                <td class="style6">
                    &nbsp;
                </td>
            </tr>--%>
        </table>
        <br />
        <table class="form-inline">
            <tr>
                <td class="style9">
                    Estado
                </td>
                <td class="style4">
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td class="style9">
                    <asp:DropDownList ID="ddlEstadoPesquisa" runat="server" OnSelectedIndexChanged="ddlEstadoPesquisa_SelectedIndexChanged"
                        Width="150px" AutoPostBack="True">
                    </asp:DropDownList>
                </td>
                <td class="style4">
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td class="style9">
                    Polo
                </td>
                <td class="style4">
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td class="style9">
                    <asp:DropDownList ID="ddlPoloPesquisa" runat="server" Enabled="False" Width="300px"
                        AutoPostBack="True" OnSelectedIndexChanged="ddlPoloPesquisa_SelectedIndexChanged">
                    </asp:DropDownList>
                </td>
            </tr>
        </table>
        <table class="form-inline">
            <tr>
                <td class="style7">
                    Turmas
                </td>
                <td class="style10">
                    &nbsp;
                </td>
                <td class="style11">
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td class="style7">
                    <asp:DropDownList ID="ddlTurmas" runat="server" Enabled="False" Width="200px" AutoPostBack="True"
                        OnSelectedIndexChanged="ddlTurmas_SelectedIndexChanged">
                    </asp:DropDownList>
                </td>
                <td class="style10">
                    &nbsp;<asp:Button ID="btnConsultarDisciplinasProfessor" formnovalidate="formnovalidate"
                        runat="server" Text="Consultar" 
                        OnClick="btnConsultarDisciplinasProfessor_Click" Width="100px" />
                </td>
                <td class="style12">
                    *Só poderá incluir cronograma se a disciplina possuir docente cadastrado.
                </td>
            </tr>
        </table>
        <br />
        <asp:GridView ID="gvwDiscProfessor" runat="server" AutoGenerateColumns="False" CssClass="mGrid"
            DataKeyNames="ID_DISCIPLINA,ID_PROFISSIONAL_DISCIPLINA,ID_PROFISSIONAL,ID_TURMA"
            EmptyDataText="Dados não localizados..." GridLines="Vertical" AllowPaging="True"
            OnPageIndexChanging="gvwDiscProfessor_PageIndexChanging" Width="90%" OnSelectedIndexChanged="gvwDiscProfessor_SelectedIndexChanged"
            OnRowDataBound="gvwDiscProfessor_RowDataBound">
            <AlternatingRowStyle BackColor="#D3D3D3" />
            <Columns>
                <asp:CommandField ButtonType="Image" SelectImageUrl="~/Imagens/select.png" ShowSelectButton="True">
                    <ItemStyle Width="1%" />
                </asp:CommandField>
                <asp:BoundField DataField="NOME_DISCIPLINA" HeaderText="Disciplina">
                    <HeaderStyle HorizontalAlign="Center" Width="30%" />
                    <ItemStyle HorizontalAlign="Left" Width="30%" />
                </asp:BoundField>
                <asp:BoundField DataField="descricao_nivel_titulacao" HeaderText="Titulação">
                    <HeaderStyle HorizontalAlign="Center" Width="10%" />
                    <ItemStyle HorizontalAlign="Left" Width="10%" />
                </asp:BoundField>
                <asp:BoundField DataField="PROFISSIONAL" HeaderText="Docente">
                    <HeaderStyle HorizontalAlign="Center" Width="20%" />
                    <ItemStyle HorizontalAlign="Left" Width="20%" />
                </asp:BoundField>
            </Columns>
            <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
            <PagerStyle CssClass="pagination" ForeColor="Black" HorizontalAlign="Center" />
            <SelectedRowStyle BackColor="#1E90FF" Font-Bold="True" ForeColor="White" />
            <SortedAscendingCellStyle BackColor="#F1F1F1" />
            <SortedAscendingHeaderStyle BackColor="#808080" />
            <SortedDescendingCellStyle BackColor="#CAC9C9" />
            <SortedDescendingHeaderStyle BackColor="#383838" />
        </asp:GridView>
        <br />
        <br />
    </asp:Panel>
    <br />
        <asp:Panel ID="pnlCronograma" runat="server" GroupingText="Cronograma da Disciplina"
            Visible="false">
            <asp:GridView ID="gvwCronograma" runat="server" AutoGenerateColumns="False" CssClass="mGrid"
                DataKeyNames="ID_CRONOGRAMA,ID_PROFISSIONAL_DISCIPLINA" EmptyDataText="Dados não localizados..."
                GridLines="Vertical" AllowPaging="True" OnPageIndexChanging="gvwCronograma_PageIndexChanging"
                OnRowCommand="gvwCronograma_RowCommand" OnRowCreated="gvwCronograma_RowCreated"
                OnRowDataBound="gvwCronograma_RowDataBound" Width="90%" 
                onselectedindexchanged="gvwCronograma_SelectedIndexChanged">
                <AlternatingRowStyle BackColor="#D3D3D3" />
                <Columns>
                    <asp:CommandField ButtonType="Image" SelectImageUrl="~/Imagens/select.png" 
                        ShowSelectButton="True">
                        <ItemStyle Width="1%" />
                    </asp:CommandField>
                    <asp:TemplateField HeaderText="Editar" ShowHeader="False">
                        <ItemTemplate>
                            <abbr>
                                <asp:ImageButton ID="ImgAlterar" runat="server" CausesValidation="false" CommandName="Alterar"
                                    formnovalidate="formnovalidate" ImageUrl="~/Imagens/edit.png" Text="Alterar"
                                    Width="20px" />
                            </abbr>
                        </ItemTemplate>
                        <HeaderStyle HorizontalAlign="Center" Width="1%" />
                        <ItemStyle HorizontalAlign="Center" Width="1%" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Excluir" ShowHeader="False">
                        <ItemTemplate>
                            <abbr title="Excluir">
                                <asp:ImageButton ID="Excluir" formnovalidate="formnovalidate" 
                                runat="server" CausesValidation="false"
                                    OnClientClick="return ShowConfirm('Tem certeza que deseja excluir?', this.ID);"
                                    CommandName="Excluir" ImageUrl="~/Imagens/delete.png" Text="Excluir" 
                                Width="20px" />
                            </abbr>
                        </ItemTemplate>
                        <HeaderStyle HorizontalAlign="Center" Width="1%" />
                        <ItemStyle HorizontalAlign="Center" Width="1%" />
                    </asp:TemplateField>
                    <asp:BoundField DataField="NUMERO_AULA" HeaderText="Aula">
                        <HeaderStyle HorizontalAlign="Center" Width="5%" />
                        <ItemStyle HorizontalAlign="Center" Width="5%" />
                    </asp:BoundField>
                    <asp:BoundField DataField="DATA_AULA" HeaderText="Data">
                        <HeaderStyle HorizontalAlign="Center" Width="5%" />
                        <ItemStyle HorizontalAlign="Center" Width="5%" />
                    </asp:BoundField>
                    <asp:BoundField DataField="DESCRICAO_AULA" HeaderText="Descrição da Aula">
                        <HeaderStyle HorizontalAlign="Center" Width="20%" />
                        <ItemStyle HorizontalAlign="Left" Width="20%" />
                    </asp:BoundField>
                    <asp:BoundField DataField="CONTEUDO_AULA" HeaderText="CONTEUDO_AULA">
                        <HeaderStyle HorizontalAlign="Center" Width="5%" />
                        <ItemStyle HorizontalAlign="Center" Width="5%" />
                    </asp:BoundField>
                    <asp:BoundField DataField="QTD_FREQUENCIA" HeaderText="QTD_FREQUENCIA">
                        <HeaderStyle HorizontalAlign="Center" Width="5%" />
                        <ItemStyle HorizontalAlign="Center" Width="5%" />
                    </asp:BoundField>
                    <asp:TemplateField HeaderText="Frequência" ShowHeader="False">
                        <ItemTemplate>
                            <asp:Button ID="btnGerarExcluirFrequencia" formnovalidate="formnovalidate" CausesValidation="false"
                                CommandName="Frequencia" runat="server" />
                        </ItemTemplate>
                        <HeaderStyle HorizontalAlign="Center" Width="1%" />
                        <ItemStyle HorizontalAlign="Center" Width="1%" />
                    </asp:TemplateField>
                </Columns>
                <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
                <PagerStyle CssClass="pagination" ForeColor="Black" HorizontalAlign="Center" />
                <SelectedRowStyle BackColor="#1E90FF" Font-Bold="True" ForeColor="White" />
                <SortedAscendingCellStyle BackColor="#F1F1F1" />
                <SortedAscendingHeaderStyle BackColor="#808080" />
                <SortedDescendingCellStyle BackColor="#CAC9C9" />
                <SortedDescendingHeaderStyle BackColor="#383838" />
            </asp:GridView>
            <br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <asp:Button ID="btnIncluirCronograma" runat="server" 
                formnovalidate="formnovalidate" OnClick="btnIncluirCronograma_Click" 
                Text="Incluir" Visible="False" Width="100px" />
            <br />
            <br />
        </asp:Panel>
    <br />
    <asp:Panel ID="pnlCadastroCronograma" runat="server" GroupingText="Cadastro de Cronograma"
        Visible="False">
        <table class="style8">
            <tr>
                <td>
                    Data Aula
                </td>
            </tr>
            <tr>
                <td>
                    <asp:TextBox ID="txtDtAula" runat="server" MaxLength="10" required="" 
                        Width="150px" ReadOnly="True"></asp:TextBox>
                    <asp:CalendarExtender ID="calendarioDtAula" runat="server" Enabled="True" TargetControlID="txtDtAula">
                    </asp:CalendarExtender>
                </td>
            </tr>
            <tr>
                <td>
                    Descrição da Aula
                </td>
            </tr>
            <tr>
                <td>
                    <asp:TextBox ID="txtDescAula" runat="server" required Width="300px" MaxLength="50"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    Conteúdo da Aula
                </td>
            </tr>
            <tr>
                <td>
                    <asp:TextBox ID="txtConteudoAula" MaxLength="255" required runat="server" Height="100px"
                        TextMode="MultiLine" Width="500px"></asp:TextBox>
                </td>
            </tr>
        </table>
        <br />
        <div class="legenda">
            <asp:Button ID="btnConfirmar" runat="server" Text="Confirmar" OnClick="btnConfirmar_Click"
                Width="100px" />
            &nbsp;<asp:Button ID="btnCancelar" formnovalidate="formnovalidate" runat="server"
                Text="Cancelar" OnClick="btnCancelar_Click" Width="100px" />
        </div>
        <br />
    </asp:Panel>
    <br />
    <br />
    <asp:Panel ID="pnlFrequencia" runat="server" Visible="false" GroupingText="Cadastro da Frequência dos Alunos Matriculados na Disciplina">
        <asp:GridView ID="gvwFrequencia" runat="server" AutoGenerateColumns="False" CssClass="mGrid"
            DataKeyNames="ID_CRONOGRAMA,ID_FREQUENCIA" EmptyDataText="Dados não localizados..."
            GridLines="Vertical" Width="90%" 
            onrowdatabound="gvwFrequencia_RowDataBound">
            <AlternatingRowStyle BackColor="#D3D3D3" />
            <Columns>
                <asp:TemplateField HeaderStyle-HorizontalAlign="Center">
                    <HeaderStyle Width="1%" HorizontalAlign="Center"  />
                    <ItemStyle HorizontalAlign="Center" Font-Size="11px" Width="30px" />
                    <HeaderTemplate>
                        <%--<asp:CheckBox ID="CheckAll" runat="server" onclick="javascript:SelecionaTodosChecks(this)" />--%> 
                        Faltou?                       
                    </HeaderTemplate>
                    <ItemTemplate>
                        <asp:CheckBox ID="CheckBox1" runat="server" TextAlign="Left" HorizontalAlign="Center" />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="MATRICULA" HeaderText="Matrícula">
                    <HeaderStyle HorizontalAlign="Center" Width="5%" />
                    <ItemStyle HorizontalAlign="Center" Width="5%" />
                </asp:BoundField>
                <asp:BoundField DataField="NOME" HeaderText="Nome">
                    <HeaderStyle HorizontalAlign="Center" Width="10%" />
                    <ItemStyle HorizontalAlign="Left" Width="10%" />
                </asp:BoundField>
                <asp:BoundField DataField="SITUACAO" HeaderText="SITUACAO">
                    <HeaderStyle HorizontalAlign="Center" Width="5%" />
                    <ItemStyle HorizontalAlign="Center" Width="5%" />
                </asp:BoundField>
            </Columns>
            <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
            <PagerStyle CssClass="pagination" ForeColor="Black" HorizontalAlign="Center" />
            <SelectedRowStyle BackColor="#1E90FF" Font-Bold="True" ForeColor="White" />
            <SortedAscendingCellStyle BackColor="#F1F1F1" />
            <SortedAscendingHeaderStyle BackColor="#808080" />
            <SortedDescendingCellStyle BackColor="#CAC9C9" />
            <SortedDescendingHeaderStyle BackColor="#383838" />
        </asp:GridView>
        <br />
        <div class="legenda">
            <asp:Button ID="btnConfirmarFrequencia" runat="server" Text="Confirmar"
                Width="100px" onclick="btnConfirmarFrequencia_Click" />
            &nbsp;<asp:Button ID="btnCancelarFrequencia" formnovalidate="formnovalidate" runat="server"
                Text="Cancelar"  Width="100px" onclick="btnCancelarFrequencia_Click" />
            <br />
        </div>
    </asp:Panel>
</asp:Content>
